#pragma once
#include<iostream>
#include<vector>
using namespace std;
namespace ZLH
{
	template<class T, class Container= vector<T>>
	class priority_queue
	{
		void Adjustup(int child)
		{
			size_t parent = (child - 1) / 2;
			while (child > 0)
			{
				if (_con[child] < _con[parent])
				{
					swap(_con[child], _con[parent]);
					child = parent;
					parent = (child - 1) / 2;
				}
				else
				{
					break;
				}
			}
		}
		void AdjustDown(int parent)
		{
			size_t child = parent * 2 + 1;
			while (child < _con.size())
			{
				if (child + 1 < n && _con[child + 1] < _con[child])
				{
					++child;
				}
				if (_con[child] > _con[parent])
				{
					swap(_con[child], _con[parent])
						parent = child;
					child = parent * 2 + 1;
				}
			}
		}
		void push(const T& x)
		{
			_con.push_back(x);
			Adjustup(_con.size() - 1);
		}
		void pop()
		{
			swap(_con[0],_con[_con.size() - 1) ];
		    _con.pop_back();
		    AdjustDown(0)
		}
		size_t size()const
		{
			return _con.size();
		}
		bool empty()const
		{
			return _con.empty();
		}
	private:
		Container _con;
	};
}
